#include <bits/stdc++.h>
using namespace std;
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
using ll = long long;
void solve()
{
    string s,s1,s2;
    ll n,n1,n2;
    cin >> n;
    cin >> s;
    cin >> n1;
    cin >> s1 >>s2;
    for (int i = 0; i < n1;i++)
    {
        if(s2[i]=='V')
        {
            s = s1[i] + s;
        }
        else
            s = s + s1[i];
    }
    cout << s << endl;
}
int main()
{
    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
   return 0;
}
